#
# Copyright 2019 Cypress Semiconductor Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

print-%  : ; @echo $* = $($*)

# For dual core CEs path ../../mtb_shared
SEARCH_WIFI_RES := $(filter $(CY_GETLIBS_SHARED_PATH)/$(CY_GETLIBS_SHARED_NAME)/wifi-res%,$(SEARCH_MTB_MK))
ifeq ($(SEARCH_WIFI_RES),)
# For single core CEs path ../mtb_shared
SEARCH_WIFI_RES = $(filter $(CY_GETLIBS_SHARED_PATH)$(CY_GETLIBS_SHARED_NAME)/wifi-res%,$(SEARCH_MTB_MK))
endif

ifneq ($(filter 55572 55900 55900A0 55500 55530 89530,$(DEVICE_COMPONENTS)),)
COMPONENTS+=WIFI6
FW_PATH    := $(SEARCH_wifi-host-driver)/WHD/COMPONENT_WIFI6/resources/firmware
else
COMPONENTS+=WIFI5
FW_PATH    := $(SEARCH_wifi-host-driver)/WHD/COMPONENT_WIFI5/resources/firmware
endif

$(info The wifi resource path is: $(SEARCH_WIFI_RES))
NVRAM_PATH := $(addsuffix /nvram, $(SEARCH_WIFI_RES))
CLM_PATH   := $(addsuffix /clm, $(SEARCH_WIFI_RES))

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)	#macOS
MACADDR_TEMP1 := $(shell grep "macaddr" $(SEARCH_wifi-host-driver)/generated_mac_address.txt)
MACADDR_TEMP2 = $(word 4, $(subst =, ,$(MACADDR_TEMP1)))
MACADDR = $(subst ",,$(MACADDR_TEMP2))
else
MACADDR := $(shell grep "macaddr" $(SEARCH_wifi-host-driver)/generated_mac_address.txt | sed -n 's/.*macaddr *= *\([^" ]*\)"\?/\1/p')
endif
$(info The MAC address is: $(MACADDR))

ifeq ($(filter WIFI6,$(COMPONENTS)),WIFI6)
     ifeq ($(filter SM,$(DEVICE_COMPONENTS))$(filter SM,$(BSP_COMPONENTS)),SM)
     COMP_SECURITY_MODE := COMPONENT_SM
     CFW_EXTENTION_NAME := trxcse
     FW_EXTENTION_NAME := trxse
     else ifeq ($(filter CM,$(DEVICE_COMPONENTS))$(filter CM,$(BSP_COMPONENTS)),CM)
     COMP_SECURITY_MODE := COMPONENT_CM
     CFW_EXTENTION_NAME := trxc
     FW_EXTENTION_NAME := trx
     endif
else   #WIFI5
     ifeq ($(filter 43022,$(DEVICE_COMPONENTS)),43022)
     FW_EXTENTION_NAME := trxs
     else
     FW_EXTENTION_NAME := bin
     endif
endif

#HANDLE MACRO DEPENDENCIES
ifeq ($(findstring 43022,$(DEVICE_COMPONENTS)),43022)
DEFINES+=ULP_CONFIG
endif

#HANDLE FIRMWARE FILES
ifeq ($(filter 89530,$(DEVICE_COMPONENTS)),89530)
COMPONENTS+=89530
     ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
        FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_89530/$(COMP_SECURITY_MODE)/89530A0-mfgtest.$(CFW_EXTENTION_NAME)"
     else
        FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_89530/$(COMP_SECURITY_MODE)/89530A0.$(CFW_EXTENTION_NAME)"
     endif
else ifeq ($(filter 55900,$(DEVICE_COMPONENTS)),55900)
COMPONENTS+=55900
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_55900/$(COMP_SECURITY_MODE)/55900A0-mfgtest.$(CFW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_55900/$(COMP_SECURITY_MODE)/55900A0.$(CFW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 55500,$(DEVICE_COMPONENTS)),55500)
COMPONENTS+=55500
	ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_55500/$(COMP_SECURITY_MODE)/55500A1-mfgtest.$(CFW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_55500/$(COMP_SECURITY_MODE)/55500A1.$(CFW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 55572,$(DEVICE_COMPONENTS)),55572)
COMPONENTS+=55572
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_55572/$(COMP_SECURITY_MODE)/55572A1-mfgtest.$(FW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_55572/$(COMP_SECURITY_MODE)/55572A1.$(FW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 55530,$(DEVICE_COMPONENTS)),55530)
COMPONENTS+=55530
	ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_55530/$(COMP_SECURITY_MODE)/55530A0-mfgtest.$(CFW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_55530/$(COMP_SECURITY_MODE)/55530A0.$(CFW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 43439,$(DEVICE_COMPONENTS)),43439)
COMPONENTS+=43439
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
                FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43439/43439A0-mfgtest.$(FW_EXTENTION_NAME)"
        else
                FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43439/43439A0.$(FW_EXTENTION_NAME)"
        endif
else ifeq ($(filter 43012,$(DEVICE_COMPONENTS)),43012)
COMPONENTS+=43012
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43012/43012C0-mfgtest.$(FW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43012/43012C0.$(FW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 43022,$(DEVICE_COMPONENTS)),43022)
COMPONENTS+=43022
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43022/COMPONENT_SM/43022C1-mfgtest.$(FW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43022/COMPONENT_SM/43022C1.$(FW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 4373,$(DEVICE_COMPONENTS)),4373)
COMPONENTS+=4373
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_4373/4373A0-mfgtest.$(FW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_4373/4373A0.$(FW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 43438,$(DEVICE_COMPONENTS)),43438)
COMPONENTS+=43438
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43438/43438A1-mfgtest.$(FW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43438/43438A1.$(FW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 43364,$(DEVICE_COMPONENTS)),43364)
COMPONENTS+=43364
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43364/43364A1-mfgtest.$(FW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_43364/43364A1.$(FW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 4390X,$(DEVICE_COMPONENTS)),4390X)
COMPONENTS+=4390X
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_4390X/43909B0-mfgtest.$(FW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_4390X/43909B0.$(FW_EXTENTION_NAME)"
	endif
else ifeq ($(filter 4343W,$(DEVICE_COMPONENTS)),4343W)
COMPONENTS+=4343W
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_4343W/4343WA1-mfgtest.$(FW_EXTENTION_NAME)"
	else
		FW_FILE_PATH_NAME := "$(FW_PATH)/COMPONENT_4343W/4343WA1.$(FW_EXTENTION_NAME)"
	endif
endif

# Handle NVRAM and CLM FILES
ifeq ($(filter 89530,$(DEVICE_COMPONENTS)),89530)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
                ifeq ($(filter CYW989530WLIPAREV1_01,$(DEVICE_COMPONENTS))$(filter CYW989530WLIPAREV1_01,$(BSP_COMPONENTS)),CYW989530WLIPAREV1_01)
                        CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_89530/COMPONENT_CYW989530WLIPAREV1_01/89530A0-mfgtest.clm_blob"
                else ifeq ($(filter CYW989530WLIPAREV1_02,$(DEVICE_COMPONENTS))$(filter CYW989530WLIPAREV1_02,$(BSP_COMPONENTS)),CYW989530WLIPAREV1_02)
                        CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_89530/COMPONENT_CYW989530WLIPAREV1_02/89530A0-mfgtest.clm_blob"
                endif
        else
                ifeq ($(filter CYW989530WLIPAREV1_01,$(DEVICE_COMPONENTS))$(filter CYW989530WLIPAREV1_01,$(BSP_COMPONENTS)),CYW989530WLIPAREV1_01)
                        CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_89530/COMPONENT_CYW989530WLIPAREV1_01/89530A0.clm_blob"
                else ifeq ($(filter CYW989530WLIPAREV1_02,$(DEVICE_COMPONENTS))$(filter CYW989530WLIPAREV1_02,$(BSP_COMPONENTS)),CYW989530WLIPAREV1_02)
                        CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_89530/COMPONENT_CYW989530WLIPAREV1_02/89530A0.clm_blob"
                endif
        endif
        ifeq ($(filter CYW989530WLIPAREV1_01,$(DEVICE_COMPONENTS))$(filter CYW989530WLIPAREV1_01,$(BSP_COMPONENTS)),CYW989530WLIPAREV1_01)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_89530/COMPONENT_CYW989530WLIPAREV1_01/*.txt)"
        else ifeq ($(filter CYW989530WLIPAREV1_02,$(DEVICE_COMPONENTS))$(filter CYW989530WLIPAREV1_02,$(BSP_COMPONENTS)),CYW989530WLIPAREV1_02)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_89530/COMPONENT_CYW989530WLIPAREV1_02/*.txt)"
        endif
else ifeq ($(filter 55900,$(DEVICE_COMPONENTS)),55900)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter CYW955913SDCM2WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955913SDCM2WLIPA,$(BSP_COMPONENTS)),CYW955913SDCM2WLIPA)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913SDCM2WLIPA/55900A0-mfgtest.clm_blob"
		else ifeq ($(filter CYW955913WLIPAREV1_01,$(DEVICE_COMPONENTS))$(filter CYW955913WLIPAREV1_01,$(BSP_COMPONENTS)),CYW955913WLIPAREV1_01)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913WLIPAREV1_01/55900A0-mfgtest.clm_blob"
		else ifeq ($(filter CYW955913WLIPAREV1_03,$(DEVICE_COMPONENTS))$(filter CYW955913WLIPAREV1_03,$(BSP_COMPONENTS)),CYW955913WLIPAREV1_03)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913WLIPAREV1_03/55900A0-mfgtest.clm_blob"
		endif
	else
		ifeq ($(filter CYW955913SDCM2WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955913SDCM2WLIPA,$(BSP_COMPONENTS)),CYW955913SDCM2WLIPA)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913SDCM2WLIPA/55900A0.clm_blob"
		else ifeq ($(filter CYW955913WLIPAREV1_01,$(DEVICE_COMPONENTS))$(filter CYW955913WLIPAREV1_01,$(BSP_COMPONENTS)),CYW955913WLIPAREV1_01)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913WLIPAREV1_01/55900A0.clm_blob"
		else ifeq ($(filter CYW955913WLIPAREV1_03,$(DEVICE_COMPONENTS))$(filter CYW955913WLIPAREV1_03,$(BSP_COMPONENTS)),CYW955913WLIPAREV1_03)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913WLIPAREV1_03/55900A0.clm_blob"
		endif
	endif
	ifeq ($(filter CYW955913SDCM2WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955913SDCM2WLIPA,$(BSP_COMPONENTS)),CYW955913SDCM2WLIPA)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913SDCM2WLIPA/*.txt)"
	else ifeq ($(filter CYW955913WLIPAREV1_01,$(DEVICE_COMPONENTS))$(filter CYW955913WLIPAREV1_01,$(BSP_COMPONENTS)),CYW955913WLIPAREV1_01)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913WLIPAREV1_01/*.txt)"
	else ifeq ($(filter CYW955913WLIPAREV1_03,$(DEVICE_COMPONENTS))$(filter CYW955913WLIPAREV1_03,$(BSP_COMPONENTS)),CYW955913WLIPAREV1_03)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55900/COMPONENT_CYW955913WLIPAREV1_03/*.txt)"
	endif
else ifeq ($(filter 55500,$(DEVICE_COMPONENTS)),55500)
	ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter CYW955513SDM2WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955513SDM2WLIPA,$(BSP_COMPONENTS)),CYW955513SDM2WLIPA)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW955513SDM2WLIPA/55500A1-mfgtest.clm_blob"
		else ifeq ($(filter CYW55513IUBG,$(DEVICE_COMPONENTS))$(filter CYW55513IUBG,$(BSP_COMPONENTS)),CYW55513IUBG)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW55513IUBG/55500A1-mfgtest.clm_blob"
		else ifeq ($(filter CYW955513WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955513WLIPA,$(BSP_COMPONENTS)),CYW955513WLIPA)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW955513WLIPA/55500A1-mfgtest.clm_blob"
		endif
	else
		ifeq ($(filter CYW955513SDM2WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955513SDM2WLIPA,$(BSP_COMPONENTS)),CYW955513SDM2WLIPA)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW955513SDM2WLIPA/55500A1.clm_blob"
		else ifeq ($(filter CYW55513IUBG,$(DEVICE_COMPONENTS))$(filter CYW55513IUBG,$(BSP_COMPONENTS)),CYW55513IUBG)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW55513IUBG/55500A1.clm_blob"
		else ifeq ($(filter CYW955513WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955513WLIPA,$(BSP_COMPONENTS)),CYW955513WLIPA)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW955513WLIPA/55500A1.clm_blob"
		endif
	endif
	ifeq ($(filter CYW955513SDM2WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955513SDM2WLIPA,$(BSP_COMPONENTS)),CYW955513SDM2WLIPA)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW955513SDM2WLIPA/*.txt)"
	else ifeq ($(filter CYW55513IUBG,$(DEVICE_COMPONENTS))$(filter CYW55513IUBG,$(BSP_COMPONENTS)),CYW55513IUBG)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW55513IUBG/*.txt)"
	else ifeq ($(filter CYW955513WLIPA,$(DEVICE_COMPONENTS))$(filter CYW955513WLIPA,$(BSP_COMPONENTS)),CYW955513WLIPA)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55500/COMPONENT_CYW955513WLIPA/*.txt)"
	endif
else ifeq ($(filter 55572,$(DEVICE_COMPONENTS)),55572)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter CYW955572FCIPA,$(DEVICE_COMPONENTS)),CYW955572FCIPA)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55572/COMPONENT_CYW955572FCIPA/55572A1-mfgtest.clm_blob"
		else ifeq ($(filter CYW955573M2IPA1,$(DEVICE_COMPONENTS)),CYW955573M2IPA1)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55572/COMPONENT_CYW955573M2IPA1/55572A1-mfgtest.clm_blob"
		endif
	else
		ifeq ($(filter CYW955572FCIPA,$(DEVICE_COMPONENTS)),CYW955572FCIPA)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55572/COMPONENT_CYW955572FCIPA/55572A1.clm_blob"
		else ifeq ($(filter CYW955573M2IPA1,$(DEVICE_COMPONENTS)),CYW955573M2IPA1)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55572/COMPONENT_CYW955573M2IPA1/55572A1.clm_blob"
		endif
	endif
	ifeq ($(filter CYW955572FCIPA,$(DEVICE_COMPONENTS)),CYW955572FCIPA)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55572/COMPONENT_CYW955572FCIPA/*.txt)"
	else ifeq ($(filter CYW955573M2IPA1,$(DEVICE_COMPONENTS)),CYW955573M2IPA1)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55572/COMPONENT_CYW955573M2IPA1/*.txt)"
	endif
else ifeq ($(filter 55530,$(DEVICE_COMPONENTS)),55530)
	ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter CYW955530WLSDUSB,$(DEVICE_COMPONENTS))$(filter CYW955530WLSDUSB,$(BSP_COMPONENTS)),CYW955530WLSDUSB)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55530/COMPONENT_CYW955530WLSDUSB/55530A0-mfgtest.clm_blob"
		endif
	else
		ifeq ($(filter CYW955530WLSDUSB,$(DEVICE_COMPONENTS))$(filter CYW955530WLSDUSB,$(BSP_COMPONENTS)),CYW955530WLSDUSB)
			CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI6/COMPONENT_55530/COMPONENT_CYW955530WLSDUSB/55530A0.clm_blob"
		endif
	endif
    ifeq ($(filter CYW955530WLSDUSB,$(DEVICE_COMPONENTS))$(filter CYW955530WLSDUSB,$(BSP_COMPONENTS)),CYW955530WLSDUSB)
		NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI6/COMPONENT_55530/COMPONENT_CYW955530WLSDUSB/*.txt)"
	endif
else ifeq ($(filter 43439,$(DEVICE_COMPONENTS)),43439)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter AZW-IFW56810,$(DEVICE_COMPONENTS))$(filter AZW-IFW56810,$(BSP_COMPONENTS)),AZW-IFW56810)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_AZW-IFW56810/43439A0-mfgtest.clm_blob"
		else ifeq ($(filter CYW943439M2IPA1,$(DEVICE_COMPONENTS))$(filter CYW943439M2IPA1,$(BSP_COMPONENTS)),CYW943439M2IPA1)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_CYW943439M2IPA1/43439A0-mfgtest.clm_blob"
		else ifeq ($(filter CYW943439WLPTH_1,$(DEVICE_COMPONENTS))$(filter CYW943439WLPTH_1,$(BSP_COMPONENTS)),CYW943439WLPTH_1)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_CYW943439WLPTH_1/43439A0-mfgtest.clm_blob"
		else ifeq ($(filter ISM43439-WBP-L151,$(DEVICE_COMPONENTS))$(filter ISM43439-WBP-L151,$(BSP_COMPONENTS)),ISM43439-WBP-L151)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_ISM43439-WBP-L151/43439A0-mfgtest.clm_blob"
		else ifeq ($(filter MURATA-1YN,$(DEVICE_COMPONENTS))$(filter MURATA-1YN,$(BSP_COMPONENTS)),MURATA-1YN)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_MURATA-1YN/43439A0-mfgtest.clm_blob"
		else ifeq ($(filter STERLING-LWBplus,$(DEVICE_COMPONENTS))$(filter STERLING-LWBplus,$(BSP_COMPONENTS)),STERLING-LWBplus)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_STERLING-LWBplus/43439A0-mfgtest.clm_blob"
		endif
    else
		ifeq ($(filter AZW-IFW56810,$(DEVICE_COMPONENTS))$(filter AZW-IFW56810,$(BSP_COMPONENTS)),AZW-IFW56810)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_AZW-IFW56810/43439A0.clm_blob"
		else ifeq ($(filter CYW943439M2IPA1,$(DEVICE_COMPONENTS))$(filter CYW943439M2IPA1,$(BSP_COMPONENTS)),CYW943439M2IPA1)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_CYW943439M2IPA1/43439A0.clm_blob"
		else ifeq ($(filter CYW943439WLPTH_1,$(DEVICE_COMPONENTS))$(filter CYW943439WLPTH_1,$(BSP_COMPONENTS)),CYW943439WLPTH_1)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_CYW943439WLPTH_1/43439A0.clm_blob"
		else ifeq ($(filter ISM43439-WBP-L151,$(DEVICE_COMPONENTS))$(filter ISM43439-WBP-L151,$(BSP_COMPONENTS)),ISM43439-WBP-L151)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_ISM43439-WBP-L151/43439A0.clm_blob"
		else ifeq ($(filter MURATA-1YN,$(DEVICE_COMPONENTS))$(filter MURATA-1YN,$(BSP_COMPONENTS)),MURATA-1YN)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_MURATA-1YN/43439A0.clm_blob"
		else ifeq ($(filter STERLING-LWBplus,$(DEVICE_COMPONENTS))$(filter STERLING-LWBplus,$(BSP_COMPONENTS)),STERLING-LWBplus)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_STERLING-LWBplus/43439A0.clm_blob"
		endif
    endif
	ifeq ($(filter AZW-IFW56810,$(DEVICE_COMPONENTS))$(filter AZW-IFW56810,$(BSP_COMPONENTS)),AZW-IFW56810)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_AZW-IFW56810/*.txt)"
	else ifeq ($(filter CYW943439M2IPA1,$(DEVICE_COMPONENTS))$(filter CYW943439M2IPA1,$(BSP_COMPONENTS)),CYW943439M2IPA1)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_CYW943439M2IPA1/*.txt)"
	else ifeq ($(filter CYW943439WLPTH_1,$(DEVICE_COMPONENTS))$(filter CYW943439WLPTH_1,$(BSP_COMPONENTS)),CYW943439WLPTH_1)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_CYW943439WLPTH_1/*.txt)"
	else ifeq ($(filter ISM43439-WBP-L151,$(DEVICE_COMPONENTS))$(filter ISM43439-WBP-L151,$(BSP_COMPONENTS)),ISM43439-WBP-L151)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_ISM43439-WBP-L151/*.txt)"
	else ifeq ($(filter MURATA-1YN,$(DEVICE_COMPONENTS))$(filter MURATA-1YN,$(BSP_COMPONENTS)),MURATA-1YN)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_MURATA-1YN/*.txt)"
	else ifeq ($(filter STERLING-LWBplus,$(DEVICE_COMPONENTS))$(filter STERLING-LWBplus,$(BSP_COMPONENTS)),STERLING-LWBplus)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43439/COMPONENT_STERLING-LWBplus/*.txt)"
    endif
else ifeq ($(filter 43012,$(DEVICE_COMPONENTS)),43012)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter CYSBSYS-RP01,$(DEVICE_COMPONENTS))$(filter CYSBSYS-RP01,$(BSP_COMPONENTS)),CYSBSYS-RP01)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYSBSYS-RP01/43012C0-mfgtest.clm_blob"
		else ifeq ($(filter CYW9WCD2REFAD2,$(DEVICE_COMPONENTS))$(filter CYW9WCD2REFAD2,$(BSP_COMPONENTS)),CYW9WCD2REFAD2)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW9WCD2REFAD2/43012C0-mfgtest.clm_blob"
		else ifeq ($(filter CYW943012P6EVB_01,$(DEVICE_COMPONENTS))$(filter CYW943012P6EVB_01,$(BSP_COMPONENTS)),CYW943012P6EVB_01)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW943012P6EVB_01/43012C0-mfgtest.clm_blob"
		else ifeq ($(filter CYW943012WCD2,$(DEVICE_COMPONENTS))$(filter CYW943012WCD2,$(BSP_COMPONENTS)),CYW943012WCD2)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW943012WCD2/43012C0-mfgtest.clm_blob"
		else ifeq ($(filter MURATA-1LV,$(DEVICE_COMPONENTS))$(filter MURATA-1LV,$(BSP_COMPONENTS)),MURATA-1LV)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_MURATA-1LV/43012C0-mfgtest.clm_blob"
		else ifeq ($(filter WM-BAC-CYW-50,$(DEVICE_COMPONENTS))$(filter WM-BAC-CYW-50,$(BSP_COMPONENTS)),WM-BAC-CYW-50)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_WM-BAC-CYW-50/43012C0-mfgtest.clm_blob"
		endif
    else
		ifeq ($(filter CYSBSYS-RP01,$(DEVICE_COMPONENTS))$(filter CYSBSYS-RP01,$(BSP_COMPONENTS)),CYSBSYS-RP01)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYSBSYS-RP01/43012C0.clm_blob"
		else ifeq ($(filter CYW9WCD2REFAD2,$(DEVICE_COMPONENTS))$(filter CYW9WCD2REFAD2,$(BSP_COMPONENTS)),CYW9WCD2REFAD2)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW9WCD2REFAD2/43012C0.clm_blob"
		else ifeq ($(filter CYW943012P6EVB_01,$(DEVICE_COMPONENTS))$(filter CYW943012P6EVB_01,$(BSP_COMPONENTS)),CYW943012P6EVB_01)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW943012P6EVB_01/43012C0.clm_blob"
		else ifeq ($(filter CYW943012WCD2,$(DEVICE_COMPONENTS))$(filter CYW943012WCD2,$(BSP_COMPONENTS)),CYW943012WCD2)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW943012WCD2/43012C0.clm_blob"
		else ifeq ($(filter MURATA-1LV,$(DEVICE_COMPONENTS))$(filter MURATA-1LV,$(BSP_COMPONENTS)),MURATA-1LV)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_MURATA-1LV/43012C0.clm_blob"
		else ifeq ($(filter WM-BAC-CYW-50,$(DEVICE_COMPONENTS))$(filter WM-BAC-CYW-50,$(BSP_COMPONENTS)),WM-BAC-CYW-50)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_WM-BAC-CYW-50/43012C0.clm_blob"
		endif
    endif
	ifeq ($(filter CYSBSYS-RP01,$(DEVICE_COMPONENTS))$(filter CYSBSYS-RP01,$(BSP_COMPONENTS)),CYSBSYS-RP01)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYSBSYS-RP01/*.txt)"
	else ifeq ($(filter CYW9WCD2REFAD2,$(DEVICE_COMPONENTS))$(filter CYW9WCD2REFAD2,$(BSP_COMPONENTS)),CYW9WCD2REFAD2)
                NVRAM_FILE_PATH_NAME := "$(wilcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW9WCD2REFAD2/*.txt)"
	else ifeq ($(filter CYW943012P6EVB_01,$(DEVICE_COMPONENTS))$(filter CYW943012P6EVB_01,$(BSP_COMPONENTS)),CYW943012P6EVB_01)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW943012P6EVB_01/*.txt)"
	else ifeq ($(filter CYW943012WCD2,$(DEVICE_COMPONENTS))$(filter CYW943012WCD2,$(BSP_COMPONENTS)),CYW943012WCD2)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_CYW943012WCD2/*.txt)"
	else ifeq ($(filter MURATA-1LV,$(DEVICE_COMPONENTS))$(filter MURATA-1LV,$(BSP_COMPONENTS)),MURATA-1LV)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_MURATA-1LV/*.txt)"
	else ifeq ($(filter WM-BAC-CYW-50,$(DEVICE_COMPONENTS))$(filter WM-BAC-CYW-50,$(BSP_COMPONENTS)),WM-BAC-CYW-50)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43012/COMPONENT_WM-BAC-CYW-50/*.txt)"
	endif
else ifeq ($(filter 43022,$(DEVICE_COMPONENTS)),43022)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
	ifeq ($(filter CYW43022CUB,$(DEVICE_COMPONENTS))$(filter CYW43022CUB,$(BSP_COMPONENTS)),CYW43022CUB)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43022/COMPONENT_CYW43022CUB/43022C1-mfgtest.clm_blob"
	else ifeq ($(filter CYW943022WLREF,$(DEVICE_COMPONENTS))$(filter CYW943022WLREF,$(BSP_COMPONENTS)),CYW943022WLREF)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43022/COMPONENT_CYW943022WLREF/43022C1-mfgtest.clm_blob"
	endif
    else
	ifeq ($(filter CYW43022CUB,$(DEVICE_COMPONENTS))$(filter CYW43022CUB,$(BSP_COMPONENTS)),CYW43022CUB)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43022/COMPONENT_CYW43022CUB/43022C1.clm_blob"
	else ifeq ($(filter CYW943022WLREF,$(DEVICE_COMPONENTS))$(filter CYW943022WLREF,$(BSP_COMPONENTS)),CYW943022WLREF)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43022/COMPONENT_CYW943022WLREF/43022C1.clm_blob"
	endif
    endif

	ifeq ($(filter CYW43022CUB,$(DEVICE_COMPONENTS))$(filter CYW43022CUB,$(BSP_COMPONENTS)),CYW43022CUB)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43022/COMPONENT_CYW43022CUB/*.txt)"
	else ifeq ($(filter CYW943022WLREF,$(DEVICE_COMPONENTS))$(filter CYW943022WLREF,$(BSP_COMPONENTS)),CYW943022WLREF)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43022/COMPONENT_CYW943022WLREF/*.txt)"
	endif
else ifeq ($(filter 4373,$(DEVICE_COMPONENTS)),4373)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
	ifeq ($(filter CYW9P62S2-M2BASE-4373,$(DEVICE_COMPONENTS))$(filter CYW9P62S2-M2BASE-4373,$(BSP_COMPONENTS)),CYW9P62S2-M2BASE-4373)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_CYW9P62S2-M2BASE-4373/4373A0-mfgtest.clm_blob"
	else ifeq ($(filter MURATA-2AE,$(DEVICE_COMPONENTS))$(filter MURATA-2AE,$(BSP_COMPONENTS)),MURATA-2AE)
		CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_MURATA-2AE/4373A0-mfgtest.clm_blob"
	else ifeq ($(filter MURATA-2BC,$(DEVICE_COMPONENTS))$(filter MURATA-2BC,$(BSP_COMPONENTS)),MURATA-2BC)
		CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_MURATA-2BC/4373A0-mfgtest.clm_blob"
	else ifeq ($(filter STERLING-LWB5plus,$(DEVICE_COMPONENTS))$(filter STERLING-LWB5plus,$(BSP_COMPONENTS)),STERLING-LWB5plus)
		CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_STERLING-LWB5plus/4373A0-mfgtest.clm_blob"
	endif
    else
        ifeq ($(filter CYW9P62S2-M2BASE-4373,$(DEVICE_COMPONENTS))$(filter CYW9P62S2-M2BASE-4373,$(BSP_COMPONENTS)),CYW9P62S2-M2BASE-4373)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_CYW9P62S2-M2BASE-4373/4373A0.clm_blob"
        else ifeq ($(filter MURATA-2AE,$(DEVICE_COMPONENTS))$(filter MURATA-2AE,$(BSP_COMPONENTS)),MURATA-2AE)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_MURATA-2AE/4373A0.clm_blob"
        else ifeq ($(filter MURATA-2BC,$(DEVICE_COMPONENTS))$(filter MURATA-2BC,$(BSP_COMPONENTS)),MURATA-2BC)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_MURATA-2BC/4373A0.clm_blob"
        else ifeq ($(filter STERLING-LWB5plus,$(DEVICE_COMPONENTS))$(filter STERLING-LWB5plus,$(BSP_COMPONENTS)),STERLING-LWB5plus)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_STERLING-LWB5plus/4373A0.clm_blob"
	endif
    endif
	ifeq ($(filter CYW9P62S2-M2BASE-4373,$(DEVICE_COMPONENTS))$(filter CYW9P62S2-M2BASE-4373,$(BSP_COMPONENTS)),CYW9P62S2-M2BASE-4373)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_CYW9P62S2-M2BASE-4373/*.txt)"
	else ifeq ($(filter MURATA-2AE,$(DEVICE_COMPONENTS))$(filter MURATA-2AE,$(BSP_COMPONENTS)),MURATA-2AE)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_MURATA-2AE/*.txt)"
	else ifeq ($(filter MURATA-2BC,$(DEVICE_COMPONENTS))$(filter MURATA-2BC,$(BSP_COMPONENTS)),MURATA-2BC)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_MURATA-2BC/*.txt)"
	else ifeq ($(filter STERLING-LWB5plus,$(DEVICE_COMPONENTS))$(filter STERLING-LWB5plus,$(BSP_COMPONENTS)),STERLING-LWB5plus)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4373/COMPONENT_STERLING-LWB5plus/*.txt)"
	endif
else ifeq ($(filter 43438,$(DEVICE_COMPONENTS)),43438)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter AW-CU427-P,$(DEVICE_COMPONENTS))$(filter AW-CU427-P,$(BSP_COMPONENTS)),AW-CU427-P)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43438/COMPONENT_AW-CU427-P/43438A1-mfgtest.clm_blob"
		endif
        else
		ifeq ($(filter AW-CU427-P,$(DEVICE_COMPONENTS))$(filter AW-CU427-P,$(BSP_COMPONENTS)),AW-CU427-P)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43438/COMPONENT_AW-CU427-P/43438A1.clm_blob"
		endif
    endif
	ifeq ($(filter AW-CU427-P,$(DEVICE_COMPONENTS))$(filter AW-CU427-P,$(BSP_COMPONENTS)),AW-CU427-P)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43438/COMPONENT_AW-CU427-P/*.txt)"
    endif
else ifeq ($(filter 43364,$(DEVICE_COMPONENTS)),43364)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter AW-CU427-P,$(DEVICE_COMPONENTS))$(filter AW-CU427-P,$(BSP_COMPONENTS)),AW-CU427-P)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43438/COMPONENT_AW-CU427-P/43364A1-mfgtest.clm_blob"
		endif
        else
		ifeq ($(filter AW-CU427-P,$(DEVICE_COMPONENTS))$(filter AW-CU427-P,$(BSP_COMPONENTS)),AW-CU427-P)
					CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_43438/COMPONENT_AW-CU427-P/43364A1.clm_blob"
		endif
    endif
	ifeq ($(filter AW-CU427-P,$(DEVICE_COMPONENTS))$(filter AW-CU427-P,$(BSP_COMPONENTS)),AW-CU427-P)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_43438/COMPONENT_AW-CU427-P/*.txt)"
    endif
else ifeq ($(filter 4390X,$(DEVICE_COMPONENTS)),4390X)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
        ifeq ($(filter CYW943907AEVAL1F,$(DEVICE_COMPONENTS))$(filter CYW943907AEVAL1F,$(BSP_COMPONENTS)),CYW943907AEVAL1F)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4390X/COMPONENT_CYW943907AEVAL1F/43909B0-mfgtest.clm_blob"
		else ifeq ($(filter CYW954907AEVAL1F,$(DEVICE_COMPONENTS))$(filter CYW954907AEVAL1F,$(BSP_COMPONENTS)),CYW954907AEVAL1F)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4390X/COMPONENT_CYW954907AEVAL1F/43909B0-mfgtest.clm_blob"
        endif
        else
        ifeq ($(filter CYW943907AEVAL1F,$(DEVICE_COMPONENTS))$(filter CYW943907AEVAL1F,$(BSP_COMPONENTS)),CYW943907AEVAL1F)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4390X/COMPONENT_CYW943907AEVAL1F/43909B0.clm_blob"
		else ifeq ($(filter CYW954907AEVAL1F,$(DEVICE_COMPONENTS))$(filter CYW954907AEVAL1F,$(BSP_COMPONENTS)),CYW954907AEVAL1F)
                CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4390X/COMPONENT_CYW954907AEVAL1F/43909B0.clm_blob"
        endif
        endif
        ifeq ($(filter CYW943907AEVAL1F,$(DEVICE_COMPONENTS))$(filter CYW943907AEVAL1F,$(BSP_COMPONENTS)),CYW943907AEVAL1F)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4390X/COMPONENT_CYW943907AEVAL1F/*.txt)"
		else ifeq ($(filter CYW954907AEVAL1F,$(DEVICE_COMPONENTS))$(filter CYW954907AEVAL1F,$(BSP_COMPONENTS)),CYW954907AEVAL1F)
                NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4390X/COMPONENT_CYW954907AEVAL1F/*.txt)"
        endif
else ifeq ($(filter 4343W,$(DEVICE_COMPONENTS)),4343W)
    ifeq ($(filter WLAN_MFG_FIRMWARE,$(DEFINES)),WLAN_MFG_FIRMWARE)
		ifeq ($(filter BCM94343WWCD2,$(DEVICE_COMPONENTS))$(filter BCM94343WWCD2,$(BSP_COMPONENTS)),BCM94343WWCD2)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_BCM94343WWCD2/4343WA1-mfgtest.clm_blob"
		else  ifeq ($(filter CY8CKIT_062,$(DEVICE_COMPONENTS))$(filter CY8CKIT_062,$(BSP_COMPONENTS)),CY8CKIT_062)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_CY8CKIT_062/4343WA1-mfgtest.clm_blob"
		else  ifeq ($(filter MURATA-1DX,$(DEVICE_COMPONENTS))$(filter MURATA-1DX,$(BSP_COMPONENTS)),MURATA-1DX)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_MURATA-1DX/4343WA1-mfgtest.clm_blob"
		endif
        else
		ifeq ($(filter BCM94343WWCD2,$(DEVICE_COMPONENTS))$(filter BCM94343WWCD2,$(BSP_COMPONENTS)),BCM94343WWCD2)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_BCM94343WWCD2/4343WA1.clm_blob"
		else  ifeq ($(filter CY8CKIT_062,$(DEVICE_COMPONENTS))$(filter CY8CKIT_062,$(BSP_COMPONENTS)),CY8CKIT_062)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_CY8CKIT_062/4343WA1.clm_blob"
		else  ifeq ($(filter MURATA-1DX,$(DEVICE_COMPONENTS))$(filter MURATA-1DX,$(BSP_COMPONENTS)),MURATA-1DX)
				CLM_FILE_PATH_NAME := "$(CLM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_MURATA-1DX/4343WA1.clm_blob"
		endif
    endif
	ifeq ($(filter BCM94343WWCD2,$(DEVICE_COMPONENTS))$(filter BCM94343WWCD2,$(BSP_COMPONENTS)),BCM94343WWCD2)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_BCM94343WWCD2/*.txt)"
	else  ifeq ($(filter CY8CKIT_062,$(DEVICE_COMPONENTS))$(filter CY8CKIT_062,$(BSP_COMPONENTS)),CY8CKIT_062)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_CY8CKIT_062/*.txt)"
	else  ifeq ($(filter MURATA-1DX,$(DEVICE_COMPONENTS))$(filter MURATA-1DX,$(BSP_COMPONENTS)),MURATA-1DX)
			NVRAM_FILE_PATH_NAME := "$(wildcard $(NVRAM_PATH)/COMPONENT_WIFI5/COMPONENT_4343W/COMPONENT_MURATA-1DX/*.txt)"
	endif
endif

$(info FW_FILE_PATH_NAME is: $(FW_FILE_PATH_NAME))
$(info NVRAM_FILE_PATH_NAME is: $(NVRAM_FILE_PATH_NAME))
$(info CLM_FILE_PATH_NAME is: $(CLM_FILE_PATH_NAME))

    # Check if DATA_PATH exists
    CHECK_PATH := $(shell [ -f "$(NVRAM_FILE_PATH_NAME)" ] && echo "exists" || echo "notfound")
    ifeq ($(CHECK_PATH),notfound)
        $(info DATA_PATH "$(NVRAM_FILE_PATH_NAME)" does not exist. Please provide a valid directory.)
    endif
    CHECK_PATH := $(shell [ -f "$(CLM_FILE_PATH_NAME)" ] && echo "exists" || echo "notfound")
    ifeq ($(CHECK_PATH),notfound)
        $(info DATA_PATH "$(CLM_FILE_PATH_NAME)" does not exist. Please provide a valid directory.)
    endif
    CHECK_PATH := $(shell [ -f "$(FW_FILE_PATH_NAME)" ] && echo "exists" || echo "notfound")
    ifeq ($(CHECK_PATH),notfound)
        $(info DATA_PATH "$(FW_FILE_PATH_NAME)" does not exist. Please provide a valid directory.)
    endif

ifeq ($(UNAME_S),Darwin)
   $(shell sed -i "" "s/^macaddr *=.*/macaddr=$(MACADDR)/" $(NVRAM_FILE_PATH_NAME))
else
   $(shell sed -i "s/^macaddr *=.*/macaddr=$(MACADDR)/" $(NVRAM_FILE_PATH_NAME))
endif

ifeq ($(TOOLCHAIN),IAR)
 # Default IAR Settings
 ifeq ($(filter $(MAKECMDGOALS),ewarm ewarm8),)
  ifeq ($(filter 4343W,$(DEVICE_COMPONENTS)),4343W)
    ifeq ($(filter CY8C6245LQI-S3D72,$(DEVICE)),CY8C6245LQI-S3D72)
      LDFLAGS+= --image_input=$(NVRAM_FILE_PATH_NAME),wifi_nvram_image_data,.cy_xip,4
      LDFLAGS+= --image_input=$(CLM_FILE_PATH_NAME),wifi_firmware_clm_blob_data,.cy_xip,4
      LDFLAGS+= --image_input=$(FW_FILE_PATH_NAME),wifi_firmware_image_data,.cy_xip,4
    else
      LDFLAGS+= --image_input=$(NVRAM_FILE_PATH_NAME),wifi_nvram_image_data,.data,4
      LDFLAGS+= --image_input=$(CLM_FILE_PATH_NAME),wifi_firmware_clm_blob_data,.data,4
      LDFLAGS+= --image_input=$(FW_FILE_PATH_NAME),wifi_firmware_image_data,.data,4
    endif
  else
    LDFLAGS+= --image_input=$(NVRAM_FILE_PATH_NAME),wifi_nvram_image_data,.data,4
    LDFLAGS+= --image_input=$(CLM_FILE_PATH_NAME),wifi_firmware_clm_blob_data,.data,4
    LDFLAGS+= --image_input=$(FW_FILE_PATH_NAME),wifi_firmware_image_data,.data,4
  endif
else
  # To compile in EWARM IAR IDE
  NVRAM_PATH_WO_QUOTE_TMP := $(subst ",,$(NVRAM_FILE_PATH_NAME))
  CLM_PATH_WO_QUOTE_TMP   := $(subst ",,$(CLM_FILE_PATH_NAME))
  FW_PATH_WO_QUOTE_TMP    := $(subst ",,$(FW_FILE_PATH_NAME))
  NVRAM_PATH_WO_QUOTE := $(addprefix $$PROJ_DIR$$/, $(NVRAM_PATH_WO_QUOTE_TMP))
  CLM_PATH_WO_QUOTE   := $(addprefix $$PROJ_DIR$$/, $(CLM_PATH_WO_QUOTE_TMP))
  FW_PATH_WO_QUOTE    := $(addprefix $$PROJ_DIR$$/, $(FW_PATH_WO_QUOTE_TMP))
  ifeq ($(filter 4343W,$(DEVICE_COMPONENTS)),4343W)
    ifeq ($(filter CY8C6245LQI-S3D72,$(DEVICE)),CY8C6245LQI-S3D72)
      LDFLAGS+= --image_input=$(NVRAM_PATH_WO_QUOTE),wifi_nvram_image_data,.cy_xip,4
      LDFLAGS+= --image_input=$(CLM_PATH_WO_QUOTE),wifi_firmware_clm_blob_data,.cy_xip,4
      LDFLAGS+= --image_input=$(FW_PATH_WO_QUOTE),wifi_firmware_image_data,.cy_xip,4
    else
      LDFLAGS+= --image_input=$(NVRAM_PATH_WO_QUOTE),wifi_nvram_image_data,.data,4
      LDFLAGS+= --image_input=$(CLM_PATH_WO_QUOTE),wifi_firmware_clm_blob_data,.data,4
      LDFLAGS+= --image_input=$(FW_PATH_WO_QUOTE),wifi_firmware_image_data,.data,4
    endif
  else
    LDFLAGS+= --image_input=$(NVRAM_PATH_WO_QUOTE),wifi_nvram_image_data,.data,4
    LDFLAGS+= --image_input=$(CLM_PATH_WO_QUOTE),wifi_firmware_clm_blob_data,.data,4
    LDFLAGS+= --image_input=$(FW_PATH_WO_QUOTE),wifi_firmware_image_data,.data,4
  endif
 endif
endif

ifeq ($(UNAME_S),Darwin)
   NVRAM_FILE_SIZE := $(shell stat -f%z $(NVRAM_FILE_PATH_NAME))
   CLM_FILE_SIZE := $(shell stat -f%z $(CLM_FILE_PATH_NAME))
   FW_FILE_SIZE := $(shell stat -f%z $(FW_FILE_PATH_NAME))
else
   NVRAM_FILE_SIZE := $(shell stat -c%s $(NVRAM_FILE_PATH_NAME))
   CLM_FILE_SIZE := $(shell stat -c%s $(CLM_FILE_PATH_NAME))
   FW_FILE_SIZE := $(shell stat -c%s $(FW_FILE_PATH_NAME))
endif

   DEFINES+= NVRAM_IMAGE_SIZE=$(NVRAM_FILE_SIZE) CLM_IMAGE_SIZE=$(CLM_FILE_SIZE) FW_IMAGE_SIZE=$(FW_FILE_SIZE)
   DEFINES+= NVRAM_IMAGE_NAME='$(NVRAM_FILE_PATH_NAME)' CLM_IMAGE_NAME='$(CLM_FILE_PATH_NAME)' FW_IMAGE_NAME='$(FW_FILE_PATH_NAME)'
